# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=geary
pkgver=44.1
pkgrel=1
pkgdesc="Geary is an email application built around conversations"
url="https://wiki.gnome.org/Apps/Geary"
arch="all"
license="LGPL-2.1-or-later AND CC-BY-3.0 AND BSD-2-Clause"
depends="
	dbus:org.freedesktop.Secrets
	dbus:org.freedesktop.Telepathy.AccountManager
	iso-codes
	"
makedepends="
	appstream-glib-dev
	desktop-file-utils
	enchant2-dev
	folks-dev
	gcr-dev
	glib-dev
	gmime-dev
	gnome-online-accounts-dev
	gsound-dev
	gspell-dev
	gtk+3.0-dev
	iso-codes-dev
	itstool
	json-glib-dev
	libcanberra-dev
	libgee-dev
	libhandy1-dev
	libnotify-dev
	libpeas-dev
	libsecret-dev
	libstemmer-dev
	libxml2-dev
	meson
	sqlite-dev
	vala
	webkit2gtk-4.1-dev
	ytnef-dev
	"
checkdepends="
	dbus
	gnutls-utils
	ibus
	xvfb-run
	xz
	"
options="!check" # https://gitlab.gnome.org/GNOME/geary/-/issues/776
subpackages="$pkgname-dbg $pkgname-lang $pkgname-doc"
source="https://download.gnome.org/sources/geary/${pkgver%.*}/geary-$pkgver.tar.xz"

# secfixes:
#   3.37.91-r0:
#     - CVE-2020-24661

build() {
	abuild-meson \
		-Db_lto=true \
		-Dlibunwind=disabled \
		-Dprofile=release \
		. output
	meson compile -C output
}

check() {
	LANG="en_US.UTF-8" \
	XDG_RUNTIME_DIR="$(mktemp -d -p "$builddir")" \
	xvfb-run -a \
	dbus-run-session -- \
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
f84d0fc1ce0b34d867acaf97f891c79f0c74cd6f020f6224663c985e2be102469b974a75f6f7bf6daa580fdf88d3413fcf16096d0dc89638081fa045ab2e152a  geary-44.1.tar.xz
"
